<?php include PATH_TPL."/admin/tpl.header.phtml"?>
<div class="main-container inner">
    <div class="main-content">
        <div class="container-fluid">
            <div class="row bt">
                <div class="col-lg-12 bg">
                    <ol class="breadcrumb">
                        <li class="active">
                            <i class="fa  fa-fw fa-reorder"></i>  案件管理
                        </li>
                    </ol>
                </div>
            </div>
            <div classs="row">
                <div classs="col-md-4">
                    <form method="post" action="/admin_case">
                            <a class="btn btn-success" id="default">重置</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <!--<select class="form-group" name="insurance_name">
                                <option>保险公司</option>
                                <?foreach($tHCDatas as $tPRow){?>
                                <option <?if($pInsurancename == $tPRow['INSURANCE_NAME']){echo 'selected';}?>><?=$tPRow['INSURANCE_NAME']?></option>
                                <?}?>
                            </select>-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <!--<select class="form-group" name="policyname">
                                <option>投保单位</optiion>
                                <?foreach($tCompany as $tHCDIRow){?>
                                <option <?if($pPolicyname == $tHCDIRow['policyname']){echo 'selected';}?>><?=$tHCDIRow['policyname']?></option>
                                <?}?>
                            </select>-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <!--<select class="form-group" name="insuredgrade">
                                <option>用户等级</option>
                                <option value="0" <?if($pInsuredgrade == '0'){echo 'selected';}?>>普通</option>
                                <option value="2" <?if($pInsuredgrade == '2'){echo 'selected';}?>>临时VIP</option>
                                <option value="1" <?if($pInsuredgrade == '1'){echo 'selected';}?>>VIP</option>
                            </select>-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <!--<select class="form-group" name="status">
                                <option>审核状态</option>
                                <option value="1" <?if($pStatus == '1'){echo 'selected';}?>>审核中</option>
                                <option value="2" <?if($pStatus == '2'){echo 'selected';}?>>有问题</option>
                            </select>-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                          <button type="button" class="btn btn-default" id="search" href="/admin_sign" style="float:right;right:35px;margin-right:40px;"><i class="fa fa-search"></i></button>
<input type="text" placeholder="请输入姓名关键字" value="<?=$pKey?>" name="key" class="form-controll" style="float:right;width:335px;height:33px;">
                </div>
            </div>

            <div class="panel-body text-center">
                <table class="table table-hover" id="sample-table-1">
                    <thead>
                        <tr>
                            <td>CaseID</td>
                            <td>姓名</td>
                            <td>保险公司
                            <select class="form-group" name="insurance_name">
                                <option value="">请选择</option>
                                <?foreach($tHCDatas as $tPRow){?>
                                <option <?if($pInsurancename == $tPRow['INSURANCE_NAME']){echo 'selected';}?>><?=$tPRow['INSURANCE_NAME']?></option>
                                <?}?>
							</select>
							</td>
                            <td>投保单位
                            <select class="form-group" name="policyname">
                                <option value="">请选择</optiion>
                                <?foreach($tCompany as $tHCDIRow){?>
                                <option <?if($pPolicyname == $tHCDIRow['policyname']){echo 'selected';}?>><?=$tHCDIRow['policyname']?></option>
                                <?}?>
							</select>
							</td>
                            <td>用户等级
                            <select class="form-group" name="insuredgrade">
                                <option>请选择</option>
                                <option value="0" <?if($pInsuredgrade == '0'){echo 'selected';}?>>普通</option>
                                <option value="2" <?if($pInsuredgrade == '2'){echo 'selected';}?>>临时VIP</option>
                                <option value="1" <?if($pInsuredgrade == '1'){echo 'selected';}?>>VIP</option>
							</select>
							</td>
                            <td>赔付状态
                            <select class="form-group" name="status">
                                <option value="">请选择</option>
                                <option value="1" <?if($pStatus == '1'){echo 'selected';}?>>审核中</option>
                                <option value="2" <?if($pStatus == '2'){echo 'selected';}?>>有问题</option>
							</select>
							</td>
                            <td>操作</td>
                        </tr>
                    </thead>
                    <?foreach($tDatas as $tRow){?>
                    <tr>
                        <td class="caseID"><?=$tRow['id']?></td>
                        <td><?=$tRow['username']?></td>
                        <td><?=$tRow['insurance_name']?></td>
                        <td><?=$tRow['policyname']?></td>
                        <td><?=$tInsuredgrade[$tRow['insuredgrade']]?></td>
                        <td><?=$tStatus[$tRow['status']]?></td>
                        <td>
                            <div class="visible-md visible-lg hidden-sm hidden-xs">
                                <a href="/admin_case/detail?case_id=<?=$tRow['id']?>" class="btn detail btn-green btn-xs tooltips" data-placement="top" data-original-title="查看详细" ><i class="fa fa-list"></i></a>
                            </div>

                            <div class="visible-xs visible-sm hidden-md hidden-lg">
                                <div class="btn-group">
                                    <a class="btn btn-green dropdown-toggle btn-sm" data-toggle="dropdown" href="#">
                                        <i class="fa fa-cog"></i> <span class="caret"></span>
                                    </a>
                                    <ul role="menu" class="dropdown-menu pull-right dropdown-dark">
                                        <li>
                                            <a role="menuitem" tabindex="-1" href="/admin_case/detail?case_id=<?=$tRow['id']?>">
                                                <i class="fa fa-th"></i>查看详细
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </td>
                    </tr>
<?}?>
                </table>
<?=$tShow?>
            </div>
        </div>
                    </form>
        <div class="subviews">
            <div class="subviews-container"></div>
        </div>
    </div>
    <!-- end: PAGE -->
</div>
<!-- end: MAIN CONTAINER -->

<script>
$('#search').click(function(){
    $('form').submit();
});
$('select').on('change',function(){
	$('#search').trigger('click');		
});
var l = $('.caseID').length;
var b = '';
for(var i=0;i<l;i++){
	var a = $('.caseID').eq(i).text()+',';
	b = b + a;
}
function removeLastOne(str){
	return str.substring(0,str.length - 1);
}
var c = removeLastOne(b);
$('.detail').each(function(){
	var h = $(this).attr('href');
	$(this).click(function(){
		var hh = h+'&c='+c;
		$(this).attr('href',hh);
	});		
});

//$('.detail').attr('href',h);
$('#default').click(function(){
    window.location.href = '/admin_case';
});
</script>
<?php include PATH_TPL."/admin/tpl.footer.phtml"?>
